


package ctrFinanceiro.dmp;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


/**
 * The persistent class for the cfin_categoria database table.
 * 
 */
@Entity
@Table(name="cfin_categoria", schema = "financeiro")
@NamedQueries({
	@NamedQuery(name = "Categoria.findAll", query = "SELECT u FROM Categoria u ORDER BY u.tipo, u.idCat"),
	@NamedQuery(name = "Categoria.findByTipo", query = "SELECT u FROM Categoria u WHERE u.tipo = :p0"),
	@NamedQuery(name = "Categoria.findByDescricao", query = "SELECT u FROM Categoria u WHERE u.descricao = :p0") })
public class Categoria implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="CFIN_CATEGORIA_IDCAT_GENERATOR",sequenceName = "financeiro.cfin_categoria_id_cat_seq" , allocationSize = 1 )
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CFIN_CATEGORIA_IDCAT_GENERATOR")
	@Column(name="id_cat", unique=true, nullable=false)
	private Integer idCat;

	@Column(name="cat_descricao", nullable=false, length=100)
	private String descricao;

	@Column(name="cat_tipo", nullable=false, length=1)
	@Enumerated(EnumType.STRING)
	private TipoCategoria tipo;

	//bi-directional many-to-one association to CfinConta
/*	@OneToMany(mappedBy="cfinCategoria")
	private List<Conta> cfinContas;*/

    public Categoria() {
    }

	public Categoria(Integer idCat, String descricao, TipoCategoria tipo) {
		super();
		this.idCat = idCat;
		this.descricao = descricao;
		this.tipo = tipo;
	}

	public Categoria(String descricao, TipoCategoria tipo) {
		super();
		this.descricao = descricao;
		this.tipo = tipo;
	}

	public Integer getIdCat() {
		return this.idCat;
	}

	public void setIdCat(Integer idCat) {
		this.idCat = idCat;
	}

	public String getDescricao() {
		return this.descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public TipoCategoria getTipo() {
		return this.tipo;
	}

	public void setCatTipo(TipoCategoria tipo) {
		this.tipo = tipo;
	}

	@Override
	public String toString() {
		return descricao;
	}
}